<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // localStorage.setItem('say', '阿巴阿布'); // 添加
        // let lo = localStorage.getItem('say'); // 获取
        // console.log(lo);

        // localStorage.removeItem('say') // 删除

        //-------------------------------------
        // localStorage.setItem('say', '阿巴阿布'); // 添加
        // localStorage.clear()

        // let arr = [1, 2, 3, 4];
        // localStorage.setItem('arr', JSON.stringify(arr))

        // let res = localStorage.getItem('arr');
        // let res1 = JSON.parse(res)
        // console.log(res1);

        // -----------------------------------------
        // let obj = {
        //     arr: [1, 2, 3],
        //     haha: '嘿嘿',
        //     xixi: {
        //         arr1: [4, 5, 6]
        //     }
        // };

        // localStorage.setItem('key', JSON.stringify(obj));

        // let res = JSON.parse(JSON.stringify(obj));
        // res.xixi.arr1 = [7, 8, 9]
        // console.log(obj, res);

        // -----------------------------------------
        // sessionStorage.setItem('haha', 'sss方法sss');
        // let res = sessionStorage.getItem('haha');
        // console.log(res);

        //--------------------------------------------------
    </script>
</body>

</html>